package eu.jpereira.trainings.designpatterns.creational.builder;

import eu.jpereira.trainings.designpatterns.creational.builder.json.JSONBuilder;
import eu.jpereira.trainings.designpatterns.creational.builder.json.JSONReportBody;
import eu.jpereira.trainings.designpatterns.creational.builder.model.Report;
import eu.jpereira.trainings.designpatterns.creational.builder.model.SaleEntry;
import eu.jpereira.trainings.designpatterns.creational.builder.xml.XMLBuilder;
import eu.jpereira.trainings.designpatterns.creational.builder.xml.XMLReportBody;



public class Waiter {
	
	public static Report waiter(String type, SaleEntry saleEntry) {
	
	Report report = new Report();

	// Algorithms to build the body objects are different
	if (type.equals("JSON")) {
		
		JSONReportBody reportBody = JSONBuilder.builder(saleEntry);
		report.setReportBody(reportBody);
		

	} else if (type.equals("XML")) {
		
		XMLReportBody reportBody = XMLBuilder.builder(saleEntry);
		report.setReportBody(reportBody);
		
	} else if (type.equals("HTML")) {
		
		HTMLReportBody reportBody = HTMLBuilder.builder(saleEntry);
		report.setReportBody(reportBody);
	}
	return report;
	}

}
